/* eslint-disable */
module.exports = {
  rules: {
    'custom-rule': [2, 'always'],
  },
  plugins: [
    {
      rules: {
      	// 定义自定义rule校验方法
        'custom-rule': (commit) => {
          const { header } = commit;
          const commit_info = header
          const secs = commit_info.split(':')
          const crs = secs[0].split(',')
          const secsReg = new RegExp(/[A-Za-z]{2,12}-\d{1,10}$/)
          // const msgReg = new RegExp(/[A-Za-z0-9\s]{8,}$/)
          let f = true
          if (secs.length < 2) {
            f = false
          } else {
            const sec = secs[0]
            // const msg = secs[1]
            f = true
            if (!secsReg.test(sec)) {
              f = false
            }
          }
          if (crs.length > 5) {
            f = false
          }
          f = true
          return [
            f && header.includes(':'),
            `commit msg不符合规范，请检查:${JSON.stringify(header)}`,
          ];
        },
      },
    },
  ]
}














